package com.gabriellaet.string
{	
	public function trim(input:String):String
	{	
		var l:int;
		var r:int;
		
		if(input == null) return "";
				
		l = 0;
		r = input.length;
				
		while(++l < r && input.charCodeAt(l) <= 32);
		while(--r > -1 && input.charCodeAt(r) <= 32);	
		return l > r ? "" : input.substring(l, r+1);
	}
}